import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'

export function useMessage() {
  return {
    message: ElMessage,
    notification: ElNotification,
    messageBox: ElMessageBox,
    removeSuccessMessage,
    createDeleteConfirm,
    createSaveConfirm,
    createClearReprotConfirm,
    saveSuccessMessage,
    createRemoveReportMainBodyConfirm,
    createClearReportMainBodyConfirm,
    createNodeFnishiConfirm
  }
}

export function saveSuccessMessage() {
  ElMessage({
    type: 'success',
    message: '保存成功'
  })
}

export function removeSuccessMessage() {
  ElMessage({
    type: 'success',
    message: '删除成功'
  })
}

export function createDeleteConfirm() {
  return ElMessageBox.confirm(
    '确认删除此数据，此操作不可恢复，是否继续?',
    '提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'error'
    }
  )
}

export function createSaveConfirm() {
  return ElMessageBox.confirm('确定进行保存操作吗?', '温馨提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  })
}

export function createClearReprotConfirm() {
  return ElMessageBox.confirm(
    '此操作将删除所有报告内容，并进行重置，是否继续？',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  )
}

export function createNodeFnishiConfirm() {
  return ElMessageBox.confirm(
    '点击完成后，该节点工作完成提交，请确定是否无误。',
    '温馨提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning'
    }
  )
}

export function createRemoveReportMainBodyConfirm() {
  return ElMessageBox.confirm(
    '此操作将删除文本框以及文本框中内容，是否继续？',
    '温馨提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning'
    }
  )
}

export function createClearReportMainBodyConfirm() {
  return ElMessageBox.confirm(
    '此操作将删除文本框中内容，是否继续？',
    '温馨提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning'
    }
  )
}
